import React from 'react';
import {useModel,history} from 'umi';
import {useEffect} from 'react';
import styles from '../index.less'
import {useState} from 'react';
export default () => {
  let {isList , setList} = useModel('topic',model=>({isList:model.isList,setList:model.setList}))

  useEffect(()=>{
    setList()

    return () =>{

    }
  },[])
  //console.log(isList)
  async function getDetail(index:number):Promise<any>{
      console.log(index)
  }
  return (
    <div className={styles.topic}>
      {
        isList&&isList.map((item:any)=>{
          return <div key={item.id} onClick={()=>getDetail(item.id)} className={styles.topic_box}>
             <img src={item.scene_pic_url} onClick={() => {
                    history.push(`/topicDetail/${item.id}`);
                  }} alt=""></img>
             <b>{item.title}</b>
             <p>{item.subtitle}</p>
             <span><div className={styles.size}>{item.price_info}元起</div></span>
          </div>
        })
      }
    </div>
  );
}
